    // 设置cookie
    export function setCookie(c_roles, c_name, c_pwd, c_state, exdays) {
        const exdate = new Date()
        exdate.setTime(exdate.getTime() + 24 * 60 * 60 * 1000 * exdays) // 保存的天数
        window.document.cookie = 'roles' + '=' + c_roles + ';path=/;expires=' + exdate.toGMTString()
        window.document.cookie = 'username' + '=' + c_name + ';path=/;expires=' + exdate.toGMTString()
        window.document.cookie = 'password' + '=' + c_pwd + ';path=/;expires=' + exdate.toGMTString()
        window.document.cookie = 'state' + '=' + c_state + ';path=/;expires=' + exdate.toGMTString()
    }
    // 读取cookie
    export function getCookie() {
        if (document.cookie.length > 0) {
            const arr = document.cookie.split('; ')
            let loginForm = {}
            for (let i = 0; i < arr.length; i++) {
                const arr2 = arr[i].split('=')
                if (arr2[0] == 'username') {
                    loginForm.username = arr2[1]
                } else if (arr2[0] == 'roles') {
                    loginForm.roles = arr2[1]
                } else if (arr2[0] == 'password') {
                    loginForm.password = arr2[1]
                } else if (arr2[0] == 'state') {
                    loginForm.checked = Boolean(arr2[1])
                }
            }
            return loginForm
        }
    }
    // 清除cookie
    export function clearCookie() {
        this.setCookie('', '', false, -1)
    }